<template>
    <!-- 对话框表单 -->
    <el-dialog
        class="ba-operate-dialog"
        :close-on-click-modal="false"
        :model-value="['Download'].includes(baTable.form.operate!)"
        @close="baTable.toggleForm"
        width="800"
    >
        <template #header>
            <div class="title" v-drag="['.ba-operate-dialog', '.el-dialog__header']" v-zoom="'.ba-operate-dialog'">
                <span>{{ t('资料下载') }}</span>
            </div>
        </template>
        <el-scrollbar v-loading="baTable.form.loading" class="ba-table-form-scrollbar">
            <div
                class="ba-operate-form"
                :class="'ba-' + baTable.form.operate + '-form'"
                :style="'width: calc(100% - ' + baTable.form.labelWidth! / 2 + 'px)'"
            >
                <el-form
                    v-if="!baTable.form.loading"
                    ref="formRef"
                    @submit.prevent=""
                    :model="baTable.form.items"
                    label-position="right"
                    :label-width="baTable.form.labelWidth + 'px'"
                >
                    <!-- <FormItem :label="t('客户名')" type="remoteSelect" v-model="baTable.form.items!.customer_id" :input-attr="{ pk: 'id', field: 'corp_name_cn', 'remote-url': '/system/customer/index' }" /> -->
                    <!-- <el-form-item :label="t('请选择')"> -->

                    <el-form-item :label="t('报关企业')">
                        <el-select v-model="baTable.form.items!.enterprise" placeholder=" " style="width: 100%;" clearable>
                            <el-option :label="t('哇衣娜')" value="ynot" />
                            <el-option :label="t('艾斯缇')" value="st" />
                        </el-select>
                    </el-form-item>


                    <el-form-item :label="t('资料下载')">
                        <el-checkbox-group v-model="baTable.form.items!.checkedType">
                            <el-checkbox v-for="(item, index) in state.type" :key="index" :label="item.value">{{ t(item.title) }}</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                        
                        
                        
                    <!-- </el-form-item> -->
                    
                    


                </el-form>
            </div>
        </el-scrollbar>
        <template #footer>
            <div :style="'width: calc(100% - ' + baTable.form.labelWidth! / 1.8 + 'px)'">
                <el-button @click="baTable.toggleForm('')">{{ t('取消') }}</el-button>
                <el-button v-blur :loading="baTable.form.submitLoading" @click="baTable.onSubmit(formRef)" type="primary">
                    {{ baTable.form.operateIds && baTable.form.operateIds.length > 1 ? t('Save and edit next item') : t('下载') }}
                </el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import { reactive, ref, inject, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import type baTableClass from '/@/utils/baTable'
import FormItem from '/@/components/formItem/index.vue'
import type { ElForm } from 'element-plus'
import { ElMessage } from 'element-plus'
import { useFilter } from '/@/stores/filter'

// import { batchOrderFileApi } from '/@/api/most/customer/order'

const filter = useFilter();

const formRef = ref<InstanceType<typeof ElForm>>()
const baTable = inject('baTable') as baTableClass

const { t } = useI18n()

const props = {
    expandTrigger: 'hover',
}

const state = reactive({
    type: [
        { title: 'PI', value: 'invoice' },
        { title: '箱单', value: 'packing_list' },
        { title: 'CI', value: 'commercial_invoice' },
        { title: '客户合同', value: 'customer_contract' },
        { title: '报关单', value: 'baoguandan' },
        { title: '申报要素', value: 'element' },
    ],
    type2: [
        { title: '发票', value: 'invoice' },
        { title: '报关单', value: 'baoguandan' },
        { title: '客户合同', value: 'customer_contract' },
        { title: '箱单', value: 'packing_list' },
        { title: '申报要素', value: 'element' },
    ],
    checkAll: false,
    isIndeterminate: true,
    checkedType: [],
})




onMounted(() => {
})

</script>

<style scoped lang="scss">

</style>
